package demo02;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.*;

@Data
@AllArgsConstructor
@NoArgsConstructor
class Student {
    private String name;
    private int age;
}

public class Test02 {
    public static void main(String[] args) {

    }

    private static void test02() {
        Map<String, Student> studentMap = new HashMap<>();
        studentMap.put("studentOne", new Student("HanserOne", 18));
        studentMap.put("studentTwo", new Student("HanserTwo", 19));
        studentMap.put("studentThree", new Student("HanserThree", 20));
        Map<String, Map<String, Student>> map = new HashMap<>();
        map.put("studentMap", studentMap);
        map.put("studentMapTwo", studentMap);
        Set<Map.Entry<String, Map<String, Student>>> entries = map.entrySet();
        for (Map.Entry<String, Map<String, Student>> entry : entries) {
            for (Map.Entry<String, Student> studentEntry : entry.getValue().entrySet()) {
                System.out.println(entry.getKey() + " : " + studentEntry.getKey() + " : " + studentEntry.getValue());
            }
        }
    }

    private static void test01() {
        List<Student> clazz1 = new ArrayList<>();
        clazz1.add(new Student("Hanserwei0", 18));
        clazz1.add(new Student("Hanserwei1", 19));
        List<Student> clazz2 = new ArrayList<>();
        clazz2.add(new Student("Hanserwei0", 18));
        clazz2.add(new Student("Hanserwei1", 19));
        Map<String, List<Student>> map = new HashMap<>();
        map.put("clazz1", clazz1);
        map.put("clazz2", clazz2);

        Set<Map.Entry<String, List<Student>>> entries = map.entrySet();
        for (Map.Entry<String, List<Student>> entry : entries) {
            for (Student student : entry.getValue()) {
                System.out.println(student);
            }
        }
    }
}
